﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ToWaTimeReportMVC4.Models;

namespace ToWaTimeReportMVC4.Controllers
{
    [Authorize]
    public class CustomerController : Controller
    {

        ToWaService service = new ToWaService();

        //
        // GET: /Customer/

        public ActionResult Index()
        {
            return View(service.GetProjectsByCustomerId(service.GetUserByUsername(User.Identity.Name).Id));
        }

        //
        // GET: /Customer/Details/5

        public ActionResult Details(int id)
        {
            Project proj = service.GetProjectById(id);
            return View(new ProjectWrapper { Id = proj.Id, UserId = proj.UserId, Name = proj.Name, Description = proj.Description });
        }

    }
}
